﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 2.6
// Code is generated on: Tuesday, June 23, 2009 10:22:10 PM
// Code is generated using templates: SD.TemplateBindings.SqlServerSpecific.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Data;

using SD.LLBLGen.Pro.ORMSupportClasses;

namespace OrmSmackdown.LLBLGen.HelperClasses
{
	/// <summary>
	/// Singleton implementation of the PersistenceInfoProvider. This class is the singleton wrapper through which the actual instance is retrieved.
	/// </summary>
	/// <remarks>It uses a single instance of an internal class. The access isn't marked with locks as the PersistenceInfoProviderBase class is threadsafe.</remarks>
	internal sealed class PersistenceInfoProviderSingleton
	{
		#region Class Member Declarations
		private static readonly IPersistenceInfoProvider _providerInstance = new PersistenceInfoProviderCore();
		#endregion
		
		/// <summary>private ctor to prevent instances of this class.</summary>
		private PersistenceInfoProviderSingleton()
		{
		}

		/// <summary>Dummy static constructor to make sure threadsafe initialization is performed.</summary>
		static PersistenceInfoProviderSingleton()
		{
		}

		/// <summary>Gets the singleton instance of the PersistenceInfoProviderCore</summary>
		/// <returns>Instance of the PersistenceInfoProvider.</returns>
		public static IPersistenceInfoProvider GetInstance()
		{
			return _providerInstance;
		}
	}

	/// <summary>Actual implementation of the PersistenceInfoProvider. Used by singleton wrapper.</summary>
	internal class PersistenceInfoProviderCore : PersistenceInfoProviderBase
	{
		/// <summary>Initializes a new instance of the <see cref="PersistenceInfoProviderCore"/> class.</summary>
		internal PersistenceInfoProviderCore()
		{
			Init();
		}

		/// <summary>Method which initializes the internal datastores with the structure of hierarchical types.</summary>
		private void Init()
		{
			base.InitClass((8 + 0));
			InitAddressesEntityMappings();
			InitCompaniesEntityMappings();
			InitContactEntityMappings();
			InitPeopleEntityMappings();
			InitPortalPeopleXrefEntityMappings();
			InitPortalsEntityMappings();
			InitRolesEntityMappings();
			InitUserEntityMappings();

		}


		/// <summary>Inits AddressesEntity's mappings</summary>
		private void InitAddressesEntityMappings()
		{
			base.AddElementMapping( "AddressesEntity", "ORM_Smackdown", @"dbo", "Addresses", 9 );
			base.AddElementFieldMapping( "AddressesEntity", "AddressId", "AddressId", false, (int)SqlDbType.Int, 0, 0, 10, true, "SCOPE_IDENTITY()", null, typeof(System.Int32), 0 );
			base.AddElementFieldMapping( "AddressesEntity", "PersonId", "PersonId", false, (int)SqlDbType.Int, 0, 0, 10, false, "", null, typeof(System.Int32), 1 );
			base.AddElementFieldMapping( "AddressesEntity", "IsDefault", "IsDefault", false, (int)SqlDbType.Bit, 0, 0, 0, false, "", null, typeof(System.Boolean), 2 );
			base.AddElementFieldMapping( "AddressesEntity", "Line1", "Line1", false, (int)SqlDbType.VarChar, 128, 0, 0, false, "", null, typeof(System.String), 3 );
			base.AddElementFieldMapping( "AddressesEntity", "Line2", "Line2", true, (int)SqlDbType.VarChar, 128, 0, 0, false, "", null, typeof(System.String), 4 );
			base.AddElementFieldMapping( "AddressesEntity", "City", "City", false, (int)SqlDbType.VarChar, 128, 0, 0, false, "", null, typeof(System.String), 5 );
			base.AddElementFieldMapping( "AddressesEntity", "State", "State", false, (int)SqlDbType.VarChar, 2, 0, 0, false, "", null, typeof(System.String), 6 );
			base.AddElementFieldMapping( "AddressesEntity", "ZipCode", "ZipCode", false, (int)SqlDbType.Char, 5, 0, 0, false, "", null, typeof(System.String), 7 );
			base.AddElementFieldMapping( "AddressesEntity", "ZipCodePlusFour", "ZipCodePlusFour", false, (int)SqlDbType.Char, 4, 0, 0, false, "", null, typeof(System.String), 8 );
		}
		/// <summary>Inits CompaniesEntity's mappings</summary>
		private void InitCompaniesEntityMappings()
		{
			base.AddElementMapping( "CompaniesEntity", "ORM_Smackdown", @"dbo", "Companies", 2 );
			base.AddElementFieldMapping( "CompaniesEntity", "CompanyId", "CompanyId", false, (int)SqlDbType.Int, 0, 0, 10, true, "SCOPE_IDENTITY()", null, typeof(System.Int32), 0 );
			base.AddElementFieldMapping( "CompaniesEntity", "CompanyName", "CompanyName", false, (int)SqlDbType.VarChar, 50, 0, 0, false, "", null, typeof(System.String), 1 );
		}
		/// <summary>Inits ContactEntity's mappings</summary>
		private void InitContactEntityMappings()
		{
			base.AddElementMapping( "ContactEntity", "ORM_Smackdown", @"dbo", "People", 0 );

		}
		/// <summary>Inits PeopleEntity's mappings</summary>
		private void InitPeopleEntityMappings()
		{
			base.AddElementMapping( "PeopleEntity", "ORM_Smackdown", @"dbo", "People", 8 );
			base.AddElementFieldMapping( "PeopleEntity", "PersonId", "PersonId", false, (int)SqlDbType.Int, 0, 0, 10, true, "SCOPE_IDENTITY()", null, typeof(System.Int32), 0 );
			base.AddElementFieldMapping( "PeopleEntity", "FirstName", "FirstName", false, (int)SqlDbType.VarChar, 50, 0, 0, false, "", null, typeof(System.String), 1 );
			base.AddElementFieldMapping( "PeopleEntity", "LastName", "LastName", false, (int)SqlDbType.VarChar, 50, 0, 0, false, "", null, typeof(System.String), 2 );
			base.AddElementFieldMapping( "PeopleEntity", "Email", "Email", false, (int)SqlDbType.VarChar, 128, 0, 0, false, "", null, typeof(System.String), 3 );
			base.AddElementFieldMapping( "PeopleEntity", "CompanyId", "CompanyId", true, (int)SqlDbType.Int, 0, 0, 10, false, "", null, typeof(System.Int32), 4 );
			base.AddElementFieldMapping( "PeopleEntity", "RoleId", "RoleId", false, (int)SqlDbType.Int, 0, 0, 10, false, "", null, typeof(System.Int32), 5 );
			base.AddElementFieldMapping( "PeopleEntity", "ManagerPersonId", "ManagerPersonId", true, (int)SqlDbType.Int, 0, 0, 10, false, "", null, typeof(System.Int32), 6 );
			base.AddElementFieldMapping( "PeopleEntity", "UserType", "UserType", false, (int)SqlDbType.Char, 2, 0, 0, false, "", null, typeof(System.String), 7 );
		}
		/// <summary>Inits PortalPeopleXrefEntity's mappings</summary>
		private void InitPortalPeopleXrefEntityMappings()
		{
			base.AddElementMapping( "PortalPeopleXrefEntity", "ORM_Smackdown", @"dbo", "PortalPeopleXref", 2 );
			base.AddElementFieldMapping( "PortalPeopleXrefEntity", "PortalId", "PortalId", false, (int)SqlDbType.Int, 0, 0, 10, false, "", null, typeof(System.Int32), 0 );
			base.AddElementFieldMapping( "PortalPeopleXrefEntity", "PersonId", "PersonId", false, (int)SqlDbType.Int, 0, 0, 10, false, "", null, typeof(System.Int32), 1 );
		}
		/// <summary>Inits PortalsEntity's mappings</summary>
		private void InitPortalsEntityMappings()
		{
			base.AddElementMapping( "PortalsEntity", "ORM_Smackdown", @"dbo", "Portals", 3 );
			base.AddElementFieldMapping( "PortalsEntity", "PortalId", "PortalId", false, (int)SqlDbType.Int, 0, 0, 10, true, "SCOPE_IDENTITY()", null, typeof(System.Int32), 0 );
			base.AddElementFieldMapping( "PortalsEntity", "PortalName", "PortalName", false, (int)SqlDbType.VarChar, 50, 0, 0, false, "", null, typeof(System.String), 1 );
			base.AddElementFieldMapping( "PortalsEntity", "AdminUserId", "AdminUserId", false, (int)SqlDbType.Int, 0, 0, 10, false, "", null, typeof(System.Int32), 2 );
		}
		/// <summary>Inits RolesEntity's mappings</summary>
		private void InitRolesEntityMappings()
		{
			base.AddElementMapping( "RolesEntity", "ORM_Smackdown", @"dbo", "Roles", 4 );
			base.AddElementFieldMapping( "RolesEntity", "RoleId", "RoleId", false, (int)SqlDbType.Int, 0, 0, 10, true, "SCOPE_IDENTITY()", null, typeof(System.Int32), 0 );
			base.AddElementFieldMapping( "RolesEntity", "RoleName", "RoleName", false, (int)SqlDbType.VarChar, 50, 0, 0, false, "", null, typeof(System.String), 1 );
			base.AddElementFieldMapping( "RolesEntity", "IsForPortal", "IsForPortal", false, (int)SqlDbType.Bit, 0, 0, 0, false, "", null, typeof(System.Boolean), 2 );
			base.AddElementFieldMapping( "RolesEntity", "IsForContact", "IsForContact", false, (int)SqlDbType.Bit, 0, 0, 0, false, "", null, typeof(System.Boolean), 3 );
		}
		/// <summary>Inits UserEntity's mappings</summary>
		private void InitUserEntityMappings()
		{
			base.AddElementMapping( "UserEntity", "ORM_Smackdown", @"dbo", "People", 0 );

		}

	}
}